package com.lizhi.yun.db.sfrobot.entity;


import com.lizhi.mybatis.boot.Description;
import com.lizhi.yun.db.sfrobot.common.RobotType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import javax.persistence.*;
import java.util.Date;

@Data
@ToString
@Entity
@Table(name="his_center_robot_device")
@Description("机器设备")
public class RobotDevice extends AbstractHisEntity {

    @Id
    @Column(length = 30)
    @Description("lid")
    public String lid;

    @Description("记录id")
    public String id;

    @Column
    @Description("型号id")
    public String modelId;

    @Column(length = 100)
    @Description("型号名称")
    public String modelText;

    @Column(length = 50)
    @Description("型号编号")
    public String modelNo;
    /**
     * 机器人编号
     */
    @Column(length = 50)
    @Description("设备编号")
    public String no;
    /**
     * 批次编号
     */
    @Column(length = 50)
    @Description("批次编号")
    public String batchNo;

    /**
     * 通讯地址
     */
    @Column
    @Description("通讯地址")
    public String commIp;

    /**
     * communication port
     */
    @Column
    @Description("端口号")
    public Integer commPort;

    /**
     * 通讯驱动协议
     */
    @Column(length = 100)
    @Description("通信驱动协议")
    public String commDriverSpec;

    /**
     * 通讯驱动实现
     */
    @Column(length = 200)
    @Description("通讯驱动实现")
    public String commDriverImp;

    /**
     * 通讯驱动配置参数
     */
    @Column(length = 500)
    @Description("通讯驱动配置参数")
    public String commDriverSettings;

    /**
     * 出厂编码
     */
    @Column
    @Description("出厂编码")
    public String productNo;

    @Column
    @Description("生产日期")
    public Date productDate;

    /**
     * 区分上肢还是下肢
     * @see com.lizhi.yun.db.sfrobot.common.RobotType
     */
    @Column
    @Description("上下肢类型")
    public Integer type;

    @Description("上下肢机器人类型")
    @Transient
    public String typeText;

    @Column(length = 20)
    @Description("创建时间")
    public String createTime;

    /*云管需要的数据*/
    @ApiModelProperty(value = "医院ID")
    private String hospitalId;

    @ApiModelProperty(value = "系统ID")
    private String hospitalSystemId;

    public String getTypeText() {
        if (RobotType.UpperLimb.getEnValue().equals(this.type)){
            this.typeText = RobotType.UpperLimb.getEnName();
        } else if (RobotType.LowerLimb.getEnValue().equals(this.type)){
            this.typeText = RobotType.LowerLimb.getEnName();
        }
        return typeText;
    }
}
